IF EXISTS (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_InsertPOSTMOTEM')
BEGIN
	DROP PROC sp_InsertPOSTMOTEM
END
GO
CREATE PROC sp_InsertPOSTMOTEM
	@ID					INT,
	@IDFIR				INT,
	@Name				VARCHAR(40),
	@AGE				varchar(40),
	@SEX				int,
	@IMAGE				varchar(40),
	@ADDRESS			varchar(50),
	@DOCTOR				varchar(40),
	@RESULT1			text,
	@PLACE				varchar(40),
	@DATE				datetime,
	@Last_updated		datetime,
	@RESULT				INT OUT 
AS
BEGIN
	IF NOT EXISTS (SELECT * FROM POSTMOTEM WHERE @ID = ID)
	BEGIN
		insert into POSTMOTEM values(@ID,@IDFIR,@Name,@AGE,@SEX,@IMAGE,@ADDRESS,@DOCTOR,@RESULT1,@PLACE,@DATE,@Last_updated)
			SET @RESULT = 1
	END
	ELSE 
	BEGIN
		SET @RESULT = 0
	END
END
